GBML manual / Input

btn_dy

The d-pad’s vertical axis: -1 (Up), 0, or 1 (Down). Both held at once cancels to 0. Add a player number from 1 to 4 to ask another controller: btn_dy(2).

Syntax

btn_dy(player = 1) -> int

Arguments

NameType
playerint (can be left out; then it is 1)

Returns

int

Description

The d-pad's vertical axis, read as a single number: -1 while Up is held, 1 while Down is held, 0 otherwise - the vertical twin of btn_dx. Holding both Up and Down at once cancels back to 0.

Another player

Write a player number from 1 to 4 in the brackets to read that player's d-pad: btn_dy(2). Leave it out and it is player 1, the same as writing 1. The number has to be written out in the call (not kept in a variable), and a console that has fewer controllers than that tells you so when you check the game: the Game Boy Advance has one, so only player 1 works there.

Example

vsp = btn_dy() * 1.5;

Drives vertical movement straight off the d-pad's own axis reading - paired with the btn_dx() example this gives ordinary 8-way top-down movement in two lines.

On the GBA

The Game Boy Advance has one controller, so only player 1 can be asked here (written out or left out, it is the same call).

See also: btn_dxvsp